package com.weixing.mall.provider.controller.admin;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.provider.model.domain.Feedback;
import com.weixing.mall.provider.model.dto.FeedbackDto;
import com.weixing.mall.provider.model.query.FeedbackQuery;
import com.weixing.mall.provider.service.IFeedbackService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author wx
 * @Date 2019/9/16 16:36
 * @Version 1.0
 */
@RestController
@RequestMapping("feedback")
@Api(value = "意见反馈Api",tags = "意见反馈")
public class FeedbackController extends BaseController {
    @Autowired
    private IFeedbackService feedbackService;

    @ApiOperation("列表查询")
    @GetMapping("")
    public Result selectList(FeedbackQuery feedbackQuery){
        return ResultUtil.success(feedbackService.selectList(initMpPage(),feedbackQuery));
    }


    @ApiOperation(value = "删除")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "意见反馈id", paramType = "path", dataType = "long")
    })
    @PostMapping("del/{id}")
    public Result del(@PathVariable long id) {
        return feedbackService.removeById(id)  ? ResultUtil.success() : ResultUtil.error();
    }

    @ApiOperation(value = "查询详情")
    @PostMapping("selectDetail/{id}")
    public Result selectDetail(@PathVariable Long id){
        return ResultUtil.success(feedbackService.selectDetail(id));
    }
}
